import { Menu, Tray } from 'electron'
import path from 'path'

const createTray = () => {
  const tray = new Tray(
    path.resolve(
      __dirname,
      process.platform == 'darwin' ? '../../resources/camera@2x.png' : '../../resources/camera.png'
    )
  )

  const contextMenu = Menu.buildFromTemplate([
    {
      label: '退出',
      role: 'quit'
    }
  ])
  //   tray.addListener('click', (e: any) => {

  //   })
  tray.setToolTip('摄像头')
  tray.setContextMenu(contextMenu)
  return tray
}

export default createTray
